const router = require('koa-router')()
const api = require("./mock")


router.get('/', async(ctx, next) => {
  await ctx.render('index', {
    title: 'Hello Koa 2!'
  })
})

router.get('/string', async(ctx, next) => {
  ctx.body = 'koa2 string'
})




/*首页- 返回公司数据 */
router.get('/api/company/get', async(ctx, next) => {
  console.log(999999999, api)
  ctx.body = {
    code: 0,
    msg: 'mockjs模拟请求用户信息',
    data: api.companyData()
  }
});
/*首页- 专家接口数据 */
router.get('/api/index/expertData', async(ctx, next) => {
  ctx.body = {
    code: 0,
    msg: 'mockjs模拟请求用户信息',
    data: api.expertData()
  }
});
/* mock测试数据 */
router.get('/api/mock/test', async(ctx, next) => {
  let data = api.mockUserInfo();
  ctx.body = {
    code: 0,
    msg: '请求成功',
    data: data
  }

})
/* 订单详情 */
router.get('/api/order/detail', async (ctx, next) => {
  // let data = api.orderDetailData();
  ctx.body = {
    code: 0,
    msg: '详情请求成功',
    data: api.orderDetailData()
  }

})

// 发布产品
router.get('/api/product/bidding', async (ctx, next) => {
  ctx.body = api.productBidding();
}) 

// 自选产品清单数据
router.get('/sy_shop/api/index.do', async(ctx, next) => {
  ctx.body = api.suyunData();
})
//用户登录信息数据
router.get('/sy_shop/api/UserLogin', async (ctx, next) => {
  ctx.body = api.UserLogin();
})
//设置新密码接口数据
router.get('/sy_shop/api/newpassword', async (ctx, next) => {
  ctx.body = api.newpassword();
})
//找回密码接口数据
router.get('/sy_shop/api/RetrievePassword', async (ctx, next) => {
  ctx.body = api.RetrievePassword();
})
//自营商城立即下单-产品清单，支付、配送、运费结算方式数据
router.get('/sy_shop/api/Paymentmethod', async (ctx, next) => {
  ctx.body = api.Paymentmethod();
})




router.get('/json', async(ctx, next) => {
  ctx.body = {
    title: 'koa2 json'
  }
})


/* 返回自营商城地址数据 */
router.get('/api/autotrophy/address', async (ctx, next) => {
  ctx.body = {
    code: 0,
    msg: 'mockjs模拟请求用户信息',
    data: api.autotrophyData()
  }
});
/* 自营商城优惠活动数据 */
router.get('/api/order/discount', async (ctx, next) => {
  ctx.body = {
    code: 0,
    msg: 'mockjs模拟请求用户信息',
    data: api.discountData()
  }
});
/* 自营商城收货地址数据 */
router.get('/api/order/raddress', async (ctx, next) => {
  ctx.body = {
    code: 0,
    msg: 'mockjs模拟请求用户信息',
    data: api.raddressData()
  }
});

/* 自营商城产品清单数据 */
router.get('/api/order/inventory', async (ctx, next) => {
  ctx.body = {
    code: 0,
    msg: 'mockjs模拟请求用户信息',
    data: api.inventoryData()
  }
});
/* 自营商城分类筛选数据-陈永辉 */
router.get('/api/order/screening', async (ctx, next) => {
  ctx.body = {
    code: 0,
    msg: 'mockjs模拟请求用户信息',
    data: api.screeningData()
  }
});
/* 技术专家分类筛选数据-王洋 */
router.get('/api/technician/expertcf', async (ctx, next) => {
  ctx.body = {
    code: 0,
    msg: 'mockjs模拟请求用户信息',
    data: api.expertcfData()
  }
});
/* 技术中心图片-王洋 */
router.get('/api/technician/exporti', async (ctx, next) => {

  ctx.body = {
    code: 0,
    msg: 'mockjs 资讯中心数据',
    data: api.exportiData()
  }
});
/* 技术专家问答数据-王洋 */
router.get('/api/technician/problems', async (ctx, next) => {
  ctx.body = {
    code: 0,
    msg: 'mockjs模拟请求用户信息',
    data: api.problemsData()
  }
});
/* 发票接口 --郝天耀*/
router.get('/api/product/invoice', async (ctx, next) => {
  ctx.body = {
    code: 0,
    msg: "",
    data: api.invoiceData()
  }
})
/* 我的企业 */
router.get('/api/product/myenterprise', async (ctx, next) => {
  ctx.body = {
    code: 0,
    msg: "",
    data: api.myenterpriseData()
  }
})
/* 我的服务 --郝天耀*/
router.get('/api/product/service', async (ctx, next) => {
  ctx.body = {
    code: 0,
    msg: "",
    data: api.serviceData()
  }
})
/* 支出明细 --郝天耀*/
router.get('/api/product/detail', async (ctx, next) => {
  ctx.body = {
    code: 0,
    msg: "",
    data: api.detailData()
  }
})

/* 产品管理 --郝天耀 */
router.get('/api/product/management', async (ctx, next) => {
  ctx.body = {
    code:0,
    msg:"",
    data: api.managementData()
  }
})
/* 员工管理 --郝天耀 */
router.get('/api/product/staff', async (ctx, next) => {
  ctx.body = {
    code: 0,
    msg: "",
    data: api.StaffData()
  }
})

/* 订单管理 我的订单--郝天耀 */
router.get('/api/product/order', async (ctx, next) => {
  ctx.body = {
    code: 0,
    msg: "",
    data: api.orderData()
  }
})
// 物性库-分类列表数据接口
router.get('/api/mock/typelist', async (ctx, next) => {
  console.log(1)
  ctx.body = {
    code: 0,
    msg: 'mockjs模拟物性库分类列表信息',
    data: api.typelist()
  }
});

// 物性库-级别列表数据接口
router.get('/api/mock/levellist', async (ctx, next) => {

  ctx.body = {
    code: 0,
    msg: 'mockjs模拟物性库级别列表信息',
    data: api.levellist()
  }
});
// 物性库-详情列表数据
router.get('/api/mock/detailslist', async (ctx, next) => {

  ctx.body = {
    code: 0,
    msg: 'mockjs模拟物性库级别列表信息',
    data: api.detailslist()
  }
});
// 资讯中心数据
router.get('/api/mock/information', async (ctx, next) => {

  ctx.body = {
    code: 0,
    msg: 'mockjs 资讯中心数据',
    data: api.informationdata()
  }
});
// 客户资源数据
router.get('/api/mock/customer', async (ctx, next) => {

  ctx.body = {
    code: 0,
    msg: 'mockjs 客户资源数据',
    data: api.customeData()
  }
});
// 塑云金融数据
router.get('/api/mock/finaServer', async (ctx, next) => {
  
    ctx.body = {
      code: 0,
      msg: 'mockjs 数据发送成功',
      data: api.finaServer()
    }
  });
  router.get('/api/mock/ascend', async (ctx, next) => {
    
      ctx.body = {
        code: 0,
        msg: 'mockjs 数据发送成功',
        data: api.ascend()
      }
    });



// 金融服务申请数据
router.get('/api/mock/syFinPhone', async (ctx, next) => {

  ctx.body = {
    code: 0,
    msg: 'mockjs 数据发送成功',
    data: api.syFinPhoneData()
  }
});

module.exports = router